<template>
  <div class="transaction-service-list bg-c-fff right-height mb70">
    <p class="bread rel">
      <a href="javascript:void(0);" class="font-s-16">交易监控员-纠错申请记录</a>
    </p>
    <div class="content">
      <table width="100%" class="auto">
        <tr>
          <th>提交时间</th>
          <th>订单编号</th>
          <th>对应监控师</th>
          <th>操作</th>
        </tr>
        <tr v-for="item in list">
          <td>{{item.createTime}}</td>
          <td>{{item.orderId}}</td>
          <td>{{item.monitorName}}</td>
          <td>
            <button class="blue-button small-btn-css" @click="onDetailsClick(item.errorContent)">查看详情</button>
          </td>
        </tr>
      </table>
      <div class="fix foot-box">
        <div class="no-data-tip" v-show="list.length===0">暂无相关数据</div>
        <pagination :index="pageIndex" :total="pageTotal" v-show="this.list!=0" @pagechange="onPageChange"></pagination>
      </div>
    </div>
    <vodal :show="errorShow" animation="zoom" :width="380" :height="190" @hide="errorShow=false">
      <div class="vodal-main">
        <h4>查看详情</h4>
        <div class="con">
          <textarea v-model="errorCon"></textarea>
        </div>
      </div>
    </vodal>
  </div>
</template>
<script type="text/javascript">
import Pagination from '../components/Pagination'
export default {
  components: {
    Pagination
  },
  data() {
    return {
      errorShow: false,
      pageIndex: 1,
      pageTotal: 0,
      list: [],
      errorCon: ''
    }
  },
  mounted() {
    this.onPageChange(1)
  },
  methods: {
    onPageChange(n) {
      this.getData(n)
    },
    getData(n) {
      this.$http.post('/tradeError/query/trade/by/sendId', {
        page: n,
        rows: 10,
        sendType: 2
      }).then(data => {
        if (data.data.httpCode === 200) {
          this.pageIndex = n
          this.pageTotal = Math.ceil(data.data.total / 10)
          this.list = data.data.rows
          console.log(this.list)
        } else {
          console.log(data.data.msg)
          this.$toasted.show(data.data.msg)
        }
      }).catch(err => {
        console.log(err)
      })
    },
    onDetailsClick(errorContent) {
      this.errorCon = errorContent
      this.errorShow = true
    }
  }
}

</script>
<style type="text/css" scoped>
.bread {
  padding-left: 20px;
  border-bottom: 1px solid #ddd;
}

.bread a {
  line-height: 45px;
}

.content {
  padding: 20px 30px 0 30px;
}

.foot-box {
  padding: 35px 32px 15px 13px;
}

textarea {
  width: 338px;
  height: 94px;
}

</style>
